Many computer programs generate user interface displays. The user interface displays generally display information on a display screen, for observation by a user. Some of the user interface displays also include user input mechanisms that allow the user to interact with mechanisms on the user interface display to provide inputs to the computer program. Currently, some programs generate user interface displays using a synchronous programming model, while others generate the user interface displays using an asynchronous programming model.
In a synchronous system, the program may generate a user interface (UI) display on a user interface programming thread. A user interface thread (or user interface programming thread) is a thread that can have a message queue and a message loop and that dispatches messages to windows. By way of example, one such user interface display is referred to as a modal dialog display. A modal dialog display is a user interface display that requires user interaction before processing can proceed. For instance, if the user desires to delete a file, a synchronous program may generate a dialog box which states “Do you want to delete this file?”, and also display “yes” and “no” buttons for actuation by the user. In a synchronous system, processing will not continue until the user interacts with that modal dialog display by either clicking the “yes” button or the “no” button. Therefore, the program can be written in such a way that the programmer can assume that the user answered the question in the modal dialog box before the next line of program code is executed.
As another example, in a synchronous system, the synchronous program might generate a user interface display corresponding to a long-running operation. For instance, if the user has selected a large amount of text to be copied from one document and pasted to another, this operation can take several seconds. During that time, the synchronous program may inhibit other user inputs from taking place until the long-running operation has been completed. By way of example, the synchronous program can “gray out” the user interface display elements so that no user inputs are possible while the text is being copied from one document and pasted to the other document. Similarly, if the user is launching an application or booting up the system, itself, these operations can take several seconds, and might also be considered long-running operations. During those long-running operations, the system often inhibits other user inputs from taking place until the operation is complete.
This is not the case in an asynchronous system. Asynchronous systems often simply invoke a modal dialog box, or a long-running operation, in one line of code, asynchronously, so that the subsequent lines of code cannot assume that the program has received a response to the question in the modal dialog box or that the long-running operation is complete. The user interface thread is asynchronous and processing continues in the program code, regardless of whether the user has interacted with the modal dialog box or whether the operations corresponding to the UI are complete.
Asynchronous systems also operate to ensure that user interface display threads do not unnecessarily block user inputs. By way of example, if an asynchronous user interface display is generated, and it is blocking user inputs from being received by the program for a certain amount of time (such as five seconds, or ten seconds, or another threshold amount of time), then some asynchronous systems kills the user interface display thread that is blocking the user inputs (or even the entire application). The asynchronous system assumes that the user interface display thread is not responding appropriately and therefore it should be killed.
This can make it difficult to run a program written using a synchronous programming model, in a system that is generated using an asynchronous programming model. For instance, if a synchronous program is conducting a long-running operation that takes longer than five-ten seconds (by way of example), the asynchronous system might kill the application (or at least UI thread) responsible for the long-running operation. This can result in undesirable operation.
The discussion above is merely provided for general background information and is not intended to be used as an aid in determining the scope of the claimed subject matter.